import React from 'react';
import { useSelector, useDispatch } from 'react-redux'
import { Stepper, Checkbox } from 'react-vant'
import { SubmitBar } from 'react-vant';
const Index = () => {
  // 获取数据
  const cartList = useSelector(state => state.cart.cartList);

  // 修改数据
  const dispatch = useDispatch();
  return (
    <div>
      {
        cartList.map((v, i) => {
          return <dl key={i}
            className='list-item'
          >
            <dd>
              <Checkbox checked={v.state}></Checkbox>
            </dd>
            <dt><img src={v.image[0]} alt="" /></dt>
            <dd>
              <h3>{v.title}</h3>
              <div>
                <Stepper value={v.count}></Stepper>
              </div>
              <p>
                <span>单价：{v.price}</span>
                <span>销售：{v.sell}</span>
              </p>
            </dd>
          </dl>
        })
      }

      <SubmitBar
        price="3050"
        buttonText="提交订单"
      >
        <Checkbox>全选</Checkbox>
      </SubmitBar>
    </div>
  )
}

export default Index